Add a gtk-overlay-scrolling setting
authorMatthias Clasen <mclasen@redhat.com>
Wed, 22 May 2019 19:24:24 +0000 (19:24 +0000)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 31 May 2019 14:07:15 +0000 (14:07 +0000)
This is in preparation for letting user opt out of
overlay scrolling in the control-center.

gdk/wayland/gdkdisplay-wayland.c
gdk/x11/gdksettings.c
gtk/gtksettings.c

index a5370ebeeb44bc5ddc85a8f3aef84e0cfc2bf803..eb46fa42af54742ac2ec75b6774a0ec36f506b32 100644 (file)
@@ -1627,6 +1627,7 @@ static TranslationEntry translations[] = {
   { FALSE, "org.gnome.desktop.interface", "gtk-im-module", "gtk-im-module", G_TYPE_STRING, { .s = "simple" } },
   { FALSE, "org.gnome.desktop.interface", "enable-animations", "gtk-enable-animations", G_TYPE_BOOLEAN, { .b = TRUE } },
   { FALSE, "org.gnome.desktop.interface", "gtk-enable-primary-paste", "gtk-enable-primary-paste", G_TYPE_BOOLEAN, { .b = TRUE } },
+  { FALSE, "org.gnome.desktop.interface", "overlay-scrolling", "gtk-overlay-scrolling", G_TYPE_BOOLEAN, { .b = TRUE } },
   { FALSE, "org.gnome.settings-daemon.peripherals.mouse", "double-click", "gtk-double-click-time", G_TYPE_INT, { .i = 400 } },
   { FALSE, "org.gnome.settings-daemon.peripherals.mouse", "drag-threshold", "gtk-dnd-drag-threshold", G_TYPE_INT, {.i = 8 } },
   { FALSE, "org.gnome.desktop.sound", "theme-name", "gtk-sound-theme-name", G_TYPE_STRING, { .s = "freedesktop" } },
@@ -1644,7 +1645,7 @@ static TranslationEntry translations[] = {
   { FALSE, "org.gnome.desktop.wm.preferences", "action-middle-click-titlebar", "gtk-titlebar-middle-click", G_TYPE_STRING, { .s = "none" } },
   { FALSE, "org.gnome.desktop.wm.preferences", "action-right-click-titlebar", "gtk-titlebar-right-click", G_TYPE_STRING, { .s = "menu" } },
   { FALSE, "org.gnome.desktop.a11y", "always-show-text-caret", "gtk-keynav-use-caret", G_TYPE_BOOLEAN, { .b = FALSE } },
-  { FALSE, "org.gnome.fontconfig", "serial", "gtk-fontconfig-timestamp", G_TYPE_NONE, { .i = 0 } }
+  { FALSE, "org.gnome.fontconfig", "serial", "gtk-fontconfig-timestamp", G_TYPE_NONE, { .i = 0 } },
 };
 
 
index c07df4c05e7207a44de9b4d6928fd57dd33b18ab..3fe596f49ea519ee986c9d770a3de7bd0e7d05da 100644 (file)
@@ -66,6 +66,7 @@ static const struct {
   {"Gtk/RecentFilesMaxAge",   "gtk-recent-files-max-age"},
   {"Gtk/RecentFilesEnabled",  "gtk-recent-files-enabled"},
   {"Gtk/KeynavUseCaret",      "gtk-keynav-use-caret"},
+  {"Gtk/OverlayScrolling",    "gtk-overlay-scrolling"},
 
   /* These are here in order to be recognized, but are not sent to
      gtk as they are handled internally by gdk: */
index 18c3fd4eb0019659950cecce431d89dcdb6485be..77aeb3bf1bf5459983aaf00b9445a70d6108f23e 100644 (file)
@@ -191,7 +191,8 @@ enum {
   PROP_ENABLE_PRIMARY_PASTE,
   PROP_RECENT_FILES_ENABLED,
   PROP_LONG_PRESS_TIME,
-  PROP_KEYNAV_USE_CARET
+  PROP_KEYNAV_USE_CARET,
+  PROP_OVERLAY_SCROLLING
 };
 
 /* --- prototypes --- */
@@ -1002,6 +1003,22 @@ gtk_settings_class_init (GtkSettingsClass *class)
                                                                    GTK_PARAM_READWRITE),
                                              NULL);
   g_assert (result == PROP_KEYNAV_USE_CARET);
+
+  /**
+   * GtkSettings:gtk-overlay-scrolling:
+   *
+   * Whether scrolled windows may use overlayed scrolling indicators.
+   * If this is set to %FALSE, scrolled windows will have permanent
+   * scrollbars.
+   */
+  result = settings_install_property_parser (class,
+                                             g_param_spec_boolean ("gtk-overlay-scrolling",
+                                                                   P_("Whether to use overlay scrollbars"),
+                                                                   P_("Whether to use overlay scrollbars"),
+                                                                   TRUE,
+                                                                   GTK_PARAM_READWRITE),
+                                             NULL);
+  g_assert (result == PROP_OVERLAY_SCROLLING);
 }
 
 static GtkSettings *